﻿namespace WMS6.Web.Analytics
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.AnalyticsReportServiceRef;

    public class DiffCountRptQuery : BasePage
    {
        protected Button btnPrint;
        protected Button btnSearch;
        protected CheckBox ckbShowLot;
        protected CheckBox ckbShowOtherSku;
        protected DropDownList ddlExternalLot;
        protected DropDownList ddlLot;
        protected DropDownList ddlLpn;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlSkuClassID;
        protected DropDownList ddlSkuDescr;
        protected DropDownList ddlSkuID;
        protected DropDownList ddlStartLoc;
        protected DropDownList ddlVendorID;
        protected DropDownList ddlZoneID;
        protected HtmlForm F15300;
        protected HtmlInputHidden hdnActionID;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected HtmlHead Head1;
        protected Label lblEndDateTime;
        protected Label lblExternalLot;
        protected Label lblLot;
        protected Label lblLpn;
        protected Label lblOwnerID;
        protected Label lblSkuClassID;
        protected Label lblSkuDescr;
        protected Label lblSkuID;
        protected Label lblStartDateTime;
        protected Label lblStartLoc;
        protected Label lblVendorID;
        protected Label lblZoneID;
        protected HtmlLink mycss;
        protected Label one1;
        protected TextBox txtEndDateTime;
        protected TextBox txtExternalLot;
        protected TextBox txtLot;
        protected TextBox txtLpn;
        protected TextBox txtOwnerID;
        protected TextBox txtSkuClassID;
        protected TextBox txtSkuDescr;
        protected TextBox txtSkuID;
        protected TextBox txtStartDateTime;
        protected TextBox txtStartLoc;
        protected TextBox txtVendorID;
        protected TextBox txtZoneID;

        protected void btnPrint_Click(object sender, EventArgs e)
        {
            DiffCountRptQueryEntity diffCountRptQueryEntity = new DiffCountRptQueryEntity {
                OwnerID = this.OwnerID,
                SkuClassID = this.SkuClassID,
                SkuID = this.SkuID,
                StartLoc = this.StartLoc,
                ZoneID = this.ZoneID,
                ShowLot = this.ShowLot,
                ShowOtherSku = this.ShowOtherSku,
                StartTime = this.StartTime,
                EndTime = this.EndTime,
                VendorID = this.VendorID,
                SkuDescr = this.SkuDescr,
                ExternalLot = this.ExternalLot,
                LPN = this.Lpn,
                Lot = this.Lot
            };
            this.Session["PrintReportParas"] = diffCountRptQueryEntity;
            ScriptManager.RegisterStartupScript(this.Page, base.GetType(), "", "<script language='javascript'>popPrintDiffCountRpt()</script>", false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("DiffCountRptList.aspx", false);
        }

        private void InitDropDownLists()
        {
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlSkuID, 0);
            base.InitQueryDDL(this.ddlSkuClassID, 0);
            base.InitQueryDDL(this.ddlZoneID, 0);
            base.InitQueryDDL(this.ddlStartLoc, 0);
            base.InitQueryDDL(this.ddlLot, 0);
            base.InitQueryDDL(this.ddlLpn, 0);
            base.InitQueryDDL(this.ddlExternalLot, 0);
            base.InitQueryDDL(this.ddlSkuDescr, 0);
            base.InitQueryDDL(this.ddlVendorID, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.InitDropDownLists();
            }
        }

        public string EndLoc
        {
            get
            {
                return "";
            }
        }

        public string EndTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEndDateTime.Text.Trim()))
                {
                    return (Convert.ToDateTime(this.txtEndDateTime.Text).ToString("yyyy-MM-dd") + " 23:59:59");
                }
                return "9999-12-31 23:59:59";
            }
        }

        public string ExternalLot
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExternalLot.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExternalLot.Text.Trim(), this.ddlExternalLot.SelectedValue);
                }
                return "";
            }
        }

        public string Lot
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLot.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLot.Text.Trim(), this.ddlLot.SelectedValue);
                }
                return "";
            }
        }

        public string Lpn
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLpn.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLpn.Text.Trim(), this.ddlLpn.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string ShowLot
        {
            get
            {
                if (this.ckbShowLot.Checked)
                {
                    return "Y";
                }
                return "N";
            }
        }

        public string ShowOtherSku
        {
            get
            {
                if (this.ckbShowOtherSku.Checked)
                {
                    return "Y";
                }
                return "N";
            }
        }

        public string SkuClassID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuClassID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuClassID.Text.Trim(), this.ddlSkuClassID.SelectedValue);
                }
                return "";
            }
        }

        public string SkuDescr
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuDescr.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuDescr.Text.Trim(), this.ddlSkuDescr.SelectedValue);
                }
                return "";
            }
        }

        public string SkuID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuID.Text.Trim(), this.ddlSkuID.SelectedValue);
                }
                return "";
            }
        }

        public string StartLoc
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtStartLoc.Text.Trim()))
                {
                    return base.GetParamsString(this.txtStartLoc.Text.Trim(), this.ddlStartLoc.SelectedValue);
                }
                return "";
            }
        }

        public string StartTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtStartDateTime.Text.Trim()))
                {
                    return (Convert.ToDateTime(this.txtStartDateTime.Text).ToString("yyyy-MM-dd") + " 00:00:00");
                }
                return "2000-01-01 00:00:00";
            }
        }

        public string VendorID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVendorID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtVendorID.Text.Trim(), this.ddlVendorID.SelectedValue);
                }
                return "";
            }
        }

        public string ZoneID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtZoneID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtZoneID.Text.Trim(), this.ddlZoneID.SelectedValue);
                }
                return "";
            }
        }
    }
}

